<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Spec::Rails::Example::ViewExampleGroup</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Spec::Rails::Example::ViewExampleGroup</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group_rb.html">
                vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="FunctionalExampleGroup.html">
                FunctionalExampleGroup
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
View Examples live in $RAILS_ROOT/spec/views/.
</p>
<p>
View Specs use <a
href="ViewExampleGroup.html">Spec::Rails::Example::ViewExampleGroup</a>,
which provides access to views without invoking any of your controllers.
See Spec::Rails::Expectations::Matchers for information about specific
expectations that you can set on views.
</p>
<h2><a href="../Example.html">Example</a></h2>
<pre>
  describe &quot;login/login&quot; do
    before do
      render 'login/login'
    end

    it &quot;should display login form&quot; do
      response.should have_tag(&quot;form[action=/login]&quot;) do
        with_tag(&quot;input[type=text][name=email]&quot;)
        with_tag(&quot;input[type=password][name=password]&quot;)
        with_tag(&quot;input[type=submit][value=Login]&quot;)
      end
    end
  end
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000054">_assigns_hash_proxy</a>&nbsp;&nbsp;
      <a href="#M000052">render</a>&nbsp;&nbsp;
      <a href="#M000053">template</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000052" class="method-detail">
        <a name="M000052"></a>

        <div class="method-heading">
          <a href="#M000052" class="method-signature">
          <span class="method-name">render</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Renders a <a href="ViewExampleGroup.html#M000053">template</a> for a View
Spec, which then provides access to the result through the
<tt>response</tt>. Also supports <a
href="ViewExampleGroup.html#M000052">render</a> with :inline, which you can
use to spec custom form builders, helpers, etc, in the context of a view.
</p>
<h2>Examples</h2>
<pre>
  render('/people/list')
  render('/people/list', :helper =&gt; MyHelper)
  render('/people/list', :helpers =&gt; [MyHelper, MyOtherHelper])
  render(:partial =&gt; '/people/_address')
  render(:inline =&gt; &quot;&lt;% custom_helper 'argument', 'another argument' %&gt;&quot;)
</pre>
<p>
See <a
href="ViewExampleGroup.html">Spec::Rails::Example::ViewExampleGroup</a> for
more information.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000052-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb, line 98</span>
 98:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
 99:           <span class="ruby-identifier">options</span> = <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span> <span class="ruby-value">? </span><span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {}
100:           <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:template</span>] = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
101: 
102:           <span class="ruby-identifier">set_base_view_path</span>(<span class="ruby-identifier">options</span>)
103:           <span class="ruby-identifier">add_helpers</span>(<span class="ruby-identifier">options</span>)
104: 
105:           <span class="ruby-identifier">assigns</span>[<span class="ruby-identifier">:action_name</span>] = <span class="ruby-ivar">@action_name</span>
106: 
107:           <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">path_parameters</span> = {
108:           <span class="ruby-identifier">:controller</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">derived_controller_name</span>(<span class="ruby-identifier">options</span>),
109:           <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">derived_action_name</span>(<span class="ruby-identifier">options</span>)
110:           }
111: 
112:           <span class="ruby-identifier">defaults</span> = { <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> }
113:           <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span> <span class="ruby-identifier">options</span>
114: 
115:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:params</span>).<span class="ruby-identifier">reverse_merge!</span> <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">parameters</span>
116: 
117:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:initialize_current_url</span>
118: 
119:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-node">%{
120:             def controller_path
121:               &quot;#{derived_controller_name(options)}&quot;
122:             end
123: 
124:             def controller_name
125:               &quot;#{derived_controller_name(options).split('/').last}&quot;
126:             end
127:           }</span>
128: 
129:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:forget_variables_added_to_assigns</span>
130:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:render</span>, <span class="ruby-identifier">options</span>
131:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:process_cleanup</span>
132:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000053" class="method-detail">
        <a name="M000053"></a>

        <div class="method-heading">
          <a href="#M000053" class="method-signature">
          <span class="method-name">template</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This provides the <a href="ViewExampleGroup.html#M000053">template</a>. Use
this to set mock expectations for dealing with partials
</p>
<h2><a href="../Example.html">Example</a></h2>
<pre>
  describe &quot;/person/new&quot; do
    it &quot;should use the form partial&quot; do
      template.should_receive(:render).with(:partial =&gt; 'form')
      render &quot;/person/new&quot;
    end
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000053-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb, line 145</span>
145:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template</span>
146:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">template</span>
147:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000054" class="method-detail">
        <a name="M000054"></a>

        <div class="method-heading">
          <a href="#M000054" class="method-signature">
          <span class="method-name">_assigns_hash_proxy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000054-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb, line 152</span>
152:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_assigns_hash_proxy</span>
153:           <span class="ruby-ivar">@_assigns_hash_proxy</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AssignsHashProxy</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">do</span>
154:             <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">template</span>
155:           <span class="ruby-keyword kw">end</span>
156:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>